package gbench.appdemo.trading.position;

import java.text.MessageFormat;
import java.time.LocalDateTime;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 撮合成功的交易
 * @author gbench
 *
 */
@Data @AllArgsConstructor @NoArgsConstructor 
public class TradeDeal {
    
    public TradeItem getProduct() {
        return this.longPosition.getUnderlying();
    }
    
    public Double getAmount() {
        return this.longPosition.getAmount();
    }
    
    public Double getQuality() {
        return this.longPosition.getQuantity();
    }
    
    public String toString() {
        return MessageFormat.format("pct:{0},qty:{1,number,#},{2}", 
            this.getProduct(),this.getQuality(),this.createTime);
    }
    
    private TradingPositionBill longPosition;
    private TradingPositionBill shortPosition;
    private LocalDateTime createTime;// 创建时间
}
